﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using QLVMBAYDatacess;
using QLVMBAYDomain;

namespace QLVMBAY.Pages
{
    public partial class pThongTinVe : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var Lst = LoaiVeDA.Inst.GetAll(true);
                grdGiaVe.DataSource = Lst;
                grdGiaVe.DataBind();
            }
        }

        protected void grdGiaVe_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowIndex != -1)
            {
                var lVe = (LoaiVe)e.Row.DataItem;
               

                var lbl2 = e.Row.FindControl("lblPhiHuy") as Label;
                lbl2.Text = GetGiaVe(lVe.PhiHuy);

              

            }

        }
        string GetGiaVe(decimal Phi)
        {
            string str = "";
            if (Phi > 0)
            {
                str = "Thu phí: " + Phi.ToString("#,##0") + " VNĐ";
            }
            else if (Phi == 0)
            {
                str = "Miễn phí";
            }
            else if (Phi < 0)
            {
                str = "Không cho phép";
            }
            return str;
        }
    }
}